home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / Waste TCL r2 / CTSMSwitchboard.cpp next >
Encoding:
Text File  |  1994-11-30  |  2.6 KB  |  83 lines  |  [TEXT/KAHL]

  1. bjects.h>
  2. #endif
  3. #ifndef __AEREGISTRY__
  4. #include "AERegistry.h"
  5. #endif
  6. #ifndef __DISKINIT__
  7. #include <DiskInit.h>
  8. #endif
  9. #ifndef __DESK__
  10. #include <Desk.h>
  11. #endif
  12. #include <TextServices.h>
  13.  
  14. #include "CAppleEventObject.h"
  15. //#include "EPPC.h"
  16. #include "WASTE.h"
  17.  
  18. /*** Global Variables ***/
  19.     
  20. extern CApplication    *gApplication;        /* Application object                */
  21. extern CDesktop        *gDesktop;            /* The visible Desktop                */
  22. extern CBartender    *gBartender;        /* Manages all menus                */
  23. extern CBureaucrat    *gGopher;            /* First in line to get commands    */
  24. extern EventRecord    gLastMouseDown;        /* Previous mouse down event        */
  25. extern EventRecord    gLastMouseUp;        /* Previous mouse up event            */
  26. extern CView        *gLastViewHit;        /* Last view clicked in                */
  27. extern long            gSleepTime;            /* Max time between events            */
  28.                                         // TCL 1.1.3 11/30/92 BF
  29. extern Boolean        gInBackground;        /* In background under MultiFinder    */
  30. extern short         gUsingTSM;            /* Using Text Service Manager       */
  31.  
  32. /*** Class Constants ***/
  33.  
  34. #define        MouseMovedEvt        0xFA    /* Mouse moved event code            */
  35. #define        SuspendResumeEvt    0x01    /* Suspend/Resume event code        */
  36. #define        ResumeEvtMask        0x1        /* Supend or Resume selector        */
  37. #define        ConvertScrapMask    0x2        /* Scrap conversion flag            */
  38.  
  39. CTSMSwitchboard::CTSMSwitchboard()
  40.     : CSwitchboard()
  41. {
  42. }
  43.  
  44. void CTSMSwitchboard::ITSMSwitchboard(void)
  45. {
  46. }
  47.  
  48. void    CTSMSwitchboard::ProcessEvent( void)
  49. {
  50.     EventRecord            macEvent;        /* Mac Event to be processed        */
  51.     Boolean                isMyEvent;        /* Should program handle event?        */
  52.     Point                mouseLoc;        /* Mouse location in global coords    */
  53.     Boolean                handledByTSM=false;
  54.     Boolean                tsmSetCursor = false;
  55.         
  56.     gDesktop->Prepare();
  57.     GetMouse(&mouseLoc);
  58.  
  59.     if (gUsingTSM)
  60.     {
  61.         tsmSetCursor = SetTSMCursor(mouseLoc);
  62.     }
  63.     if (!tsmSetCursor) gDesktop->DispatchCursor(mouseLoc, mouseRgn);
  64.  
  65.                                         /* Get an event from the queue        */
  66.     isMyEvent = GetAnEvent( &macEvent);
  67.     
  68.     if (gUsingTSM)
  69.     {
  70.         handledByTSM = TSMEvent(&macEvent);
  71.     }
  72.     
  73.     if (isMyEvent && !handledByTSM)            /* We must respond to this event    */
  74.     {            
  75.         DispatchEvent( &macEvent);        
  76.     } 
  77.     else 
  78.     {                                    /* No action required                */
  79.         DoIdle( &macEvent);
  80.     }
  81. }
  82.  
  83.